{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import linear_model\n",
    "from sklearn.datasets import make_gaussian_quantiles\n",
    "from sklearn.preprocessing import PolynomialFeatures"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_excel('实现窃电用户行为分析-数据集.xls')\n",
    "with open('窃电用户行为分析.csv','w') as writer:\n",
    "    df.to_csv(writer,index =False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "292\n",
      "[nan  4.  4.  2.  9.  3.  2.  5.  3.  3.  4. 10. 10.  2.  4.  3.  0.  9.\n",
      "  0.  8.  2.  3.  7.  6.  4.  7.  2.  5.  1.  5.  1.  2.  6.  6.  5.  2.\n",
      "  4.  7.  6.  1.  3.  4.  8.  6.  1.  4.  2.  4.  7.  4.  0.  1.  4.  1.\n",
      "  6.  6.  6.  0.  4.  9.  0.  2.  4.  9.  0.  1.  0.  5.  4.  5.  1.  0.\n",
      "  4.  4.  3.  2.  2.  2.  4.  4.  0.  5.  1.  0.  2.  2.  0.  2.  0.  1.\n",
      "  4.  2.  3.  5.  5.  0.  3.  0.  1.  1.  1.  0.  2.  3.  1.  2.  2.  1.\n",
      "  3.  0.  5.  5.  4.  5.  5.  4.  1.  1.  4.  3.  2.  0.  3.  0.  3.  3.\n",
      "  5.  4.  4.  0.  2.  2.  5.  2.  4.  4.  2.  3.  2.  7.  5.  4.  5.  5.\n",
      "  5.  4.  1.  0.  3.  1.  1.  2.  0.  2.  1.  5.  1.  0.  3.  3.  1.  2.\n",
      "  4.  3.  3.  1.  3.  0.  1.  3.  1.  3.  2.  4.  0.  3.  3.  4.  1.  4.\n",
      "  2.  4.  5.  0.  2.  0.  2.  3.  0.  1.  0.  4.  3.  2.  1.  3.  2.  3.\n",
      "  2.  2.  4.  3.  0.  4.  3.  1.  5.  3.  4.  4.  0.  1.  1.  0.  0.  0.\n",
      "  0.  2.  1.  5.  2.  0.  1.  4.  3.  0.  4.  5.  2.  3.  4.  0.  3.  4.\n",
      "  3.  4.  2.  3.  3.  0.  0.  4.  1.  1.  0.  3.  0.  3.  0.  5.  1.  5.\n",
      "  0.  4.  5.  0.  0.  1.  3.  0.  0.  1.  5.  2.  5.  2.  2.  3.  5.  4.\n",
      "  1.  4.  2.  1.  1.  2.  3.  0.  0.  0.  1.  2.  3.  4.  2.  3.  3.  4.\n",
      "  1.  5.  2.  4.]\n"
     ]
    }
   ],
   "source": [
    "# 加载数据\n",
    "data = np.genfromtxt('窃电用户行为分析.csv',delimiter = ',')\n",
    "print(len(data))\n",
    "print(data[:,0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_data = data[:,-1]\n",
    "x_data = data[:,:-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
